package com.example.demo.controller;
        import com.example.demo.model.Dymana;
        import com.example.demo.model.User;
        import com.example.demo.service.IDymanaService;
        import io.swagger.annotations.Api;
        import io.swagger.annotations.ApiImplicitParam;
        import io.swagger.annotations.ApiImplicitParams;
        import io.swagger.annotations.ApiOperation;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.beans.factory.annotation.Value;
        import org.springframework.web.bind.annotation.*;
        import java.util.Date;
        import java.util.List;

/**
 * @author Administrator 高欣月
 */

@Api(tags = "党员信息")
@RestController
@RequestMapping("/swagger2")
public class DymanaController {
    @Autowired
    private IDymanaService dymanaService;
    @CrossOrigin
    @ApiOperation(value="对人员信息的添加方法")
    @PostMapping("/insertdymana")
    public int insertDymana(@RequestBody Dymana dymana){
        System.out.println("进入添加人员接口" );
        return dymanaService.insertDymana(dymana);
    }

    @PostMapping("/getAllDymana")
    public List<Dymana> getAllDymana(@RequestBody Dymana dymana)
    {
        System.out.println("进入查询方法");
        List<Dymana> listDymana=dymanaService.getAllDymana(dymana);
        return listDymana;
    }
    @PostMapping("/editDymana")
    public int EditDymana(@RequestBody Dymana dymana){
        System.out.println("添加修改方法");
        return dymanaService.updateDymana(dymana);
    }
    @GetMapping("/delDymana")
    public int Delete(int dyid){
        System.out.println("进入删除方法");
        int returnValues=0;
        if(dyid!=0){
            Dymana dymana=new Dymana();
            dymana.setDyid(dyid);
            returnValues=dymanaService.deleteDymana(dymana);
        }
        return returnValues;
    }

    @GetMapping("/getOneDymana")
    public Dymana getDymana(int dyid){
        Dymana dymana=new Dymana();
        System.out.println("进入单条查询方法");
        if(dyid!=0){
            Dymana dymana1=new Dymana();
            dymana1.setDyid(dyid);
            dymana=dymanaService.getDymana(dymana1);
            System.out.println("返回的数据集合为:"+dymana.getDyid());
        }
        return dymana;
    }
}
